package com.jjb.www.ui.activity;

import android.view.LayoutInflater;
import android.view.View;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.hjq.base.BaseAdapter;
import com.hjq.http.EasyHttp;
import com.hjq.http.listener.HttpCallback;
import com.hjq.shape.view.ShapeTextView;
import com.hjq.widget.layout.WrapRecyclerView;
import com.jjb.www.R;
import com.jjb.www.app.AppActivity;
import com.jjb.www.http.api.CurriculumSortApi;
import com.jjb.www.http.api.UserRecordApi;
import com.jjb.www.http.model.HttpData;
import com.jjb.www.http.model.HttpList;
import com.jjb.www.ui.adapter.EducationAdapter;
import com.jjb.www.ui.adapter.EvaluationAdapter;
import com.jjb.www.ui.fragment.CourseListFragment;

/**
 *    author : Android CRG
 *    github : https://github.com/getActivity/AndroidProject
 *    time   : 2018/10/18Evaluation
 *    desc   : 电子档案
 */
public class ArchivesActivity extends AppActivity  {
    private EducationAdapter educationAdapter;
    private View mHeadView;
    private ShapeTextView mTvRealName;
    private ShapeTextView mTvIdCard;
    private ShapeTextView mTvMobile;
    private WrapRecyclerView mRvList;



    @Override
    protected int getLayoutId() {
        return R.layout.activity_archives;
    }

    @Override
    protected void initView() {
        mHeadView = LayoutInflater.from(getContext()).inflate(R.layout.item_comprehensive_head,
                mRvList, false);

        mTvRealName = mHeadView.findViewById(R.id.tv_real_name);
        mTvIdCard = mHeadView.findViewById(R.id.tv_id_card);
        mTvMobile = mHeadView.findViewById(R.id.tv_mobile);
        mRvList = findViewById(R.id.rv_list);
        mRvList.addHeaderView(mHeadView);
        mRvList.setLayoutManager(new LinearLayoutManager(getContext()));
        educationAdapter = new EducationAdapter(getContext());
        mRvList.setAdapter(educationAdapter);
    }

    @Override
    protected void initData() {
        getUserRecord();
    }

    private void getUserRecord() {
        EasyHttp.get(this)
                .api(new UserRecordApi())
                .request(new HttpCallback<HttpData<UserRecordApi.Bean>>(this) {

                    @Override
                    public void onSucceed(HttpData<UserRecordApi.Bean> data) {
                        mTvRealName.setText(data.getData().getReal_name());
                        mTvIdCard.setText(data.getData().getId_card());
                        mTvMobile.setText(data.getData().getMobile());
                        educationAdapter.setData(data.getData().getArr());
                    }

                });
    }

}